import React from 'react'
import {Breadcrumb} from "antd";
import {Link} from 'react-router-dom';
const routesList = [
    {
        path: 'index',
        breadcrumbName: 'home',
    },
    {
        path: 'first',
        breadcrumbName: 'first',
    },
    {
        path: 'second',
        breadcrumbName: 'second',
    },
];
class TopNav extends React.Component {
    itemRender= (route, params, routes, paths)=>{
        console.log(paths)
        const last = routes.indexOf(route) === routes.length - 1;
        return last ? (
            <span>{route.breadcrumbName}</span>
        ) : (
            <Link to={paths.join('/')}>{route.breadcrumbName}</Link>
        );
    }
    render() {
        return (
            <Breadcrumb style={{ margin: '16px 0' }} itemRender={this.itemRender} routes={routesList}>
                {/*{this.topNav(list)}*/}
            </Breadcrumb>
        )
    }

}

export default TopNav